#include "DO_AN_CUOI_KI_CTDL_LTHDT.h"



Array::Array()
{
	sluong = 0;
}


Array::~Array()
{
	a.clear();
}

void Array::nhap()
{
	cout << "\nnhap so luong phan tu cua mang: ";
	cin >> sluong;
	while (sluong <= 0)
	{
		cout << "\nnhap sai, so luong phai lon hon 0, nhap lai: ";
		cin >> sluong;
	}
	a.resize(sluong);
	for (int i = 0; i < a.size(); i++)
	{
		cout << "nhap: ";
		cin >> a[i];
	}
}


void Array::Xuat()
{
	for (int i = 0; i < a.size(); i++)
	{
		cout << a[i] << ' ';
	}
	cout << endl;
}


void Array::Nhap_tu_file(char *s)
{
	int b;
	fstream f;
	f.open(s,ios_base::in);
	while (!f.eof())
	{
		f >> b;
		a.push_back(b);
	}
	sluong = a.size();
}
